package com.dolphin.common.expr;

import com.google.common.collect.Maps;
import com.googlecode.aviator.AviatorEvaluator;

import java.util.Map;

public class AviatorExpressionExecutor {

    public static Object execute(String exp){
        Object result = AviatorEvaluator.execute(exp);

        return result;
    }

    public static Object execute(String exp, Map<String, Object> context){
        Object result = AviatorEvaluator.execute(exp, context);

        return result;
    }

    public static Object executeCached(String exp){
        Object result = AviatorEvaluator.execute(exp, Maps.newHashMap(), true);

        return result;
    }

    public static Object executeCached(String exp, Map<String, Object> context){
        Object result = AviatorEvaluator.execute(exp, context, true);

        return result;
    }
}
